/**
 * Copyright 2008 by Robert Konigsberg
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the same terms as Perl.
 *
 * @see http://www.perl.com/perl/misc/Artistic.html
 */
package visitor.maze;

public enum Direction {
  NORTH,
  SOUTH,
  EAST,
  WEST;

  public Direction left() {
    switch (this) {
      case EAST: return NORTH;
      case WEST: return SOUTH;
      case SOUTH: return EAST;
      case NORTH: return WEST;
    }
    throw new IllegalStateException("Unknown direction : " + this);
  }

  public Direction opposite() {
    return left().left();
  }

  public Direction right() {
    return left().left().left();
  }
}
